package com.lyf.lottery.service;

import com.lyf.cache.redisson.RedisDelayQueueUtil;
import com.lyf.lottery.enums.RedisDelayQueueEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Random;
import java.util.concurrent.TimeUnit;

@Slf4j
@Service
public class RedissonService {

    @Resource
    private RedisDelayQueueUtil redisDelayQueueUtil;

    public void addDelay(String content) {
        for (int i = 0; i < 10; i++) {
            redisDelayQueueUtil.addDelayQueue(content+i,new Random().nextInt(10)+1,TimeUnit.SECONDS, RedisDelayQueueEnum.TEST.getCode());
        }
    }

}